import time
from selenium import webdriver
from selenium.webdriver.common.by import By
from selenium.webdriver.chrome.service import Service
from webdriver_manager.chrome import ChromeDriverManager

driver_path =ChromeDriverManager().install()
###创建Edge浏览器驱动对象
driver=webdriver.Chrome(service=Service(driver_path))
time.sleep(2)
#2.输入百度网址：https://www.baidu.com（网址一定要完整，不要写成www.baidu.com）
driver.get("https://www.baidu.com")
time.sleep(2)
#3.找到百度输入框，输入关键词“迪丽热巴”
driver.find_element(By.CSS_SELECTOR,"#chat-textarea").send_keys("迪丽热巴")
time.sleep(2)
#4.点击“百度一下”按钮
driver.find_element(By.CSS_SELECTOR,"#chat-submit-button").click()
time.sleep(2)
#5.关闭浏览器
driver.quit()